package com.team.vlog_temp.Dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class MeuDao {
    private  JdbcTemplate jdbcTemplate;

    @Autowired
    public MeuDao(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }


        public List<Map<String, Object>> getAllMeu() {
            return jdbcTemplate.queryForList("SELECT * FROM pub_meu WHERE fatherCode = '0' OR fatherCode IS NULL");
        }


        //
        //获取二级菜单
        public List<Map<String, Object>> getAllMeuSon(int fatherCode) {
            return jdbcTemplate.queryForList("SELECT * FROM " + "pub_meu"+" where fatherCode="+fatherCode);
        }

//        //获取三级菜单
//        public List<Map<String, Object>> getSanJiMeu(int fatherCode, int start, int count) {
//    return null;}
}